package com.int_tech.data;

import java.io.File;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by liubch on 2018/6/11.
 */
public class readDat {

    public static void main(String[] args) throws Exception {
        String filePath = "C:/Users/liubch/Desktop/cmd_a1.dat"; // 数据文件路径.
        Scanner scanner = new Scanner(new File(filePath));
        Pattern pattern = Pattern.compile("\\d+");

        // 存储找到的整数.
        List<Integer> values = new LinkedList<Integer>();

        while (scanner.hasNextLine()) {
            Matcher matcher = pattern.matcher(scanner.nextLine());

            while (matcher.find()) {
                values.add(Integer.parseInt(matcher.group(0))); // 找到所有的整数.
            }
        }

        System.out.println(values);
    }

}
